Drawable

data class Drawable(    @DrawableOrDrawableRes val drawable: Any,     val position: WatermarkPosition = WatermarkPosition.MIDDLE_CENTER,     val width: Float = 0.0f,     val height: Float = 0.0f,     val dx: Float = 0.0f,     val dy: Float = 0.0f,     val rotation: Float = 0.0f,     @FloatRange(from = 0.0, to = 1.0) val opacity: Float = 1.0f,     val measurementDimension: Dimension = Dimension.PX) : Watermark

Definition for a drawable watermark (shape, image, etc.)

Parameters

drawable

Drawable resource or object for the watermark.

position

Position for the watermark inside of the image.

width

Width for the watermark, if the value is zero, the intrinsic width of the drawable will be used. If the drawable has no intrinsic width, such as a solid color, an exception will be thrown.

height

Height for the watermark, if the value is zero, the intrinsic height of the drawable will be used. If the drawable has no intrinsic height, such as a solid color, an exception will be thrown.

dx

Watermark offset for the x-axis.

dy

Watermark offset for the y-axis.

rotation

Rotation in degrees for the watermark.

opacity

Opacity of the watermark. This is a value from 0 to 1, where 0 means the watermark is completely transparent and 1 means the watermark is completely opaque.

measurementDimension

Type of dimension to use to draw watermark, its apply for width, height, dx and dy. For example, if the value of width is 10f and measurementDimension is Dimension.PX, the width of the drawn watermark will be 10 px, but if measurementDimension is Dimension.DP, the the width of the drawn watermark will be calculate according the screen density. It is recommended to use only Dimension.PX or Dimension.DP for a Drawable watermark.

Constructors

Link copied to clipboard
fun Drawable(    @DrawableOrDrawableRes drawable: Any,     position: WatermarkPosition = WatermarkPosition.MIDDLE_CENTER,     width: Float = 0.0f,     height: Float = 0.0f,     dx: Float = 0.0f,     dy: Float = 0.0f,     rotation: Float = 0.0f,     @FloatRange(from = 0.0, to = 1.0) opacity: Float = 1.0f,     measurementDimension: Dimension = Dimension.PX)

Properties

Link copied to clipboard
val drawable: Any
Link copied to clipboard
open override val dx: Float = 0.0f
Link copied to clipboard
open override val dy: Float = 0.0f
Link copied to clipboard
val height: Float = 0.0f
Link copied to clipboard
open override val measurementDimension: Dimension
Link copied to clipboard
open override val opacity: Float = 1.0f
Link copied to clipboard
open override val position: WatermarkPosition
Link copied to clipboard
open override val rotation: Float = 0.0f
Link copied to clipboard
val width: Float = 0.0f